﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using GameLayer;
using Microsoft.Xna.Framework.Audio;
using MainGame;

namespace GameCharacter.AutoCharacter
{
    public class Giant : AutoCharacter
    {
        public Giant(ContentManager content)
           : base(content)
        {
            String path = "Images/Sprites/Gaint/";

            //Hit
            Sprite downHit = new Sprite(content, path + "DownHit/DownHit_", 4);
            Sprite dowLeftHit = new Sprite(content, path + "DownLeftHit/DownLeftHit_", 6);
            Sprite downRightHit = new Sprite(content, path + "DownRightHit/DownRightHit_", 5);

            Sprite leftHit = new Sprite(content, path + "LeftHit/LeftHit_", 4);
            Sprite rightHit = new Sprite(content, path + "RightHit/RightHit_", 5);

            Sprite upHit = new Sprite(content, path + "UpHit/UpHit_", 4);
            Sprite upLeftHit = new Sprite(content, path + "UpLeftHit/UpLeftHit_", 6);

            Sprite upRightHit = new Sprite(content, path + "UpRightHit/UpRightHit_", 5);
            //Go
            Sprite goDown = new Sprite(content, path + "GoDown/GoDown_", 10);
            Sprite goDownLeft = new Sprite(content, path + "GoDownLeft/GoDownLeft_", 10);
            Sprite goDownRight = new Sprite(content, path + "GoDownRight/GoDownRight_", 9);

            Sprite goLeft = new Sprite(content, path + "GoLeft/GoLeft_", 10);
            Sprite goRight = new Sprite(content, path + "GoRight/GoRight_", 8);

            Sprite goUp = new Sprite(content, path + "GoUp/GoUp_", 8);
            Sprite goUpLeft = new Sprite(content, path + "GoUpLeft/GoUpLeft_", 10);
            Sprite goUpRight = new Sprite(content, path + "GoUpRight/GoUpRight_", 7);
            //Die
            Sprite dieFromDown = new Sprite(content, path + "DieFromDown/DieFromDown_", 9);
            Sprite dieFromDownLeft = new Sprite(content, path + "DieFromDownLeft/DieFromDownLeft_", 9);
            Sprite dieFromDownRight = new Sprite(content, path + "DieFromDownRight/DieFromDownRight_", 9);

            Sprite dieFromLeft = new Sprite(content, path + "DieFromLeft/DieFromLeft_", 9);
            Sprite dieFromRight = new Sprite(content, path + "DieFromRight/DieFromRight_", 9);

            Sprite dieFromUp = new Sprite(content, path + "DieFromUp/DieFromUp_", 9);
            Sprite dieFromUpLeft = new Sprite(content, path + "DieFromUpLeft/DieFromUpLeft_", 9);
            Sprite dieFromUpRight = new Sprite(content, path + "DieFromUpRight/DieFromUpRight_", 9);



            /*----------------------------*/
            this.Items.Insert(DOWN_HIT, downHit);
            this.Items.Insert(DOWNLEFT_HIT, dowLeftHit);
            this.Items.Insert(DOWNRIGHT_HIT, downRightHit);

            this.Items.Insert(LEFT_HIT, leftHit);
            this.Items.Insert(RIGHT_HIT, rightHit);

            this.Items.Insert(UP_HIT, upHit);
            this.Items.Insert(UPLEFT_HIT, upLeftHit);
            this.Items.Insert(UPRIGHT_HIT, upRightHit);

            this.Items.Insert(GO_DOWN, goDown);
            this.Items.Insert(GO_DOWNLEFT, goDownLeft);
            this.Items.Insert(GO_DOWNRIGHT, goDownRight);

            this.Items.Insert(GO_LEFT, goLeft);
            this.Items.Insert(GO_RIGHT, goRight);

            this.Items.Insert(GO_UP, goUp);
            this.Items.Insert(GO_UPLEFT, goUpLeft);
            this.Items.Insert(GO_UPRIGHT, goUpRight);

            this.Items.Insert(DIE_FROMDOWN, dieFromDown);
            this.Items.Insert(DIE_FROMDOWNLEFT, dieFromDownLeft);
            this.Items.Insert(DIE_FROMDOWNRIGHT, dieFromDownRight);

            this.Items.Insert(DIE_FROMLEFT, dieFromLeft);
            this.Items.Insert(DIE_FROMRIGHT, dieFromRight);

            this.Items.Insert(DIE_FROMUP, dieFromUp);
            this.Items.Insert(DIE_FROMUPLEFT, dieFromUpLeft);
            this.Items.Insert(DIE_FROMUPRIGHT, dieFromUpRight);

            this.Index = DOWN_HIT;

            SoundAttack = SoundManager.Giant_Attack.CreateInstance();
            SoundDie = SoundManager.Giant_Die.CreateInstance();
            SoundBeAttacked = SoundManager.Giant_BeAttacked.CreateInstance();
        }

        private Giant(ContentManager content, List<Sprite> items)
            : base(content)
        {
            this.Items = items;
            SoundAttack = SoundManager.Giant_Attack.CreateInstance();
            SoundDie = SoundManager.Giant_Die.CreateInstance();
            SoundBeAttacked = SoundManager.Giant_BeAttacked.CreateInstance();
        }
        public override object Clone()
        {
            List<Sprite> sprites = new List<Sprite>();
            for (int i = 0; i < this.Items.Count; i++)
            {
                sprites.Add((Sprite)this.Items[i].Clone());
            }
            var temp = new Giant(this.Content, sprites);
            temp.Index = this.Index;
            return temp;
        }
    }
}
